/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cubelabs.nexus.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cubelabs.nexus.domain.SearchRequest;
import cubelabs.nexus.domain.SessionDTO;
import cubelabs.nexus.domain.UserDTO;
import cubelabs.nexus.service.SearchService;

/**
 *
 * @author chaitanya
 */
@Controller
public class SearchController {
    
    @Autowired
    private SearchService searchService;

    @RequestMapping(value = "/asearch", method = RequestMethod.POST)
    public @ResponseBody
    List<UserDTO> userSearch(HttpServletRequest request, HttpServletResponse response,@RequestBody SearchRequest searchRequest) throws Exception {
        return searchService.fetchExperts(searchRequest);
       
    }
    
    @RequestMapping(value = "/etsearch", method = RequestMethod.POST)
    public @ResponseBody
    List<SessionDTO> expertTalkSearch(HttpServletRequest request, HttpServletResponse response,@RequestBody SearchRequest searchRequest) throws Exception {
        return searchService.fetchExpertTalks(searchRequest);
       
    }
}
